package com.junlong0716.enjoylearning.ui

import android.content.Intent
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
import com.htxcsoft.corelibrary.glide.GlideUtils
import com.junlong0716.enjoylearning.HomeActivity
import com.junlong0716.enjoylearning.R
import com.junlong0716.enjoylearning.manager.UserManager
import kotlinx.android.synthetic.main.activity_splash.*

class SplashActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_splash)
        GlideUtils.showImage(this,R.mipmap.ic_bg,iv_bg)
        Handler().postDelayed({
            if (UserManager.getLoginState()) {
                startActivity(Intent(this, HomeActivity::class.java))
                overridePendingTransition(R.anim.scale_in, 0)
                finish()
            }else{
                startActivity(Intent(this, LogInActivity::class.java))
                overridePendingTransition(R.anim.scale_in, 0)
                finish()
            }

        }, 3000)
    }
}
